﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using System.ComponentModel;

namespace MyActivityLibrary
{
    public sealed class SimpleActivity : NativeActivity<string>
    {
        // this property contains an activity that will be scheduled in the execute method
        // the WorkflowItemPresenter in the designer is bound to this to enable editing
        // of the value

        //public Activity Body { get; set; }

        /*   - Linguistic Rule: (Virtual Colleage)
         *      -- Pattern (String)
         *      -- Template (String)
         *      -- Gesture (ListBox)(optional)
         *      -- Severity (int <- ListBox: [0 -5 ]) default value: 0
         *      
         */
        /*
         * struct Linguistic { String pattern; String template; String gesture; int severity };
         * PROBAR CON UN CLASE QUE SEA RULE o algo asi
         */

        [Category("Linguistic Rule")]
        //[RequiredArgument]
        [DefaultValue(" ")]
        [DescriptionAttribute("Patrón a reconocer")]
        public InArgument<string> Ling_Pattern { get; set; }
        [Category("Linguistic Rule")]
        //[RequiredArgument] [DescriptionAttribute("Required Field")]
        [DescriptionAttribute("Respuesta AV")]
        public InArgument<string> Ling_Template { get; set; }
        [Category("Linguistic Rule")]
        [DefaultValue(Gesture.Neutral)]
        public Gesture Ling_gesuture { get; set; }
        [Category("Linguistic Rule")]
        [DefaultValue(Severity.sev0)]
        public Severity Ling_severity { get; set; }

        /*   - Cultural Rule: (Virtual Colleage) has the same structure that Linguistic Rule */

        [Category("Cultural Rule")]
        //[RequiredArgument]
        [DescriptionAttribute("Required Field")]
        public InArgument<string> Cult_pattern { get; set; }
        [Category("Cultural Rule")]
        //[RequiredArgument]
        [DescriptionAttribute("Required Field")]
        public InArgument<string> Cult_template { get; set; }
        [Category("Cultural Rule")]
        [DefaultValue(Gesture.Neutral)]
        public Gesture Cult_gesture { get; set; }
        [Category("Cultural Rule")]
        [DefaultValue(Severity.sev0)]
        public Severity Cult_severity { get; set; }

        /*      
         *    - Conversation Rule: (Virtual Agent)
         *      -- Pattern (String)
         *      -- Template (String)
         *      -- Gesture (ListBox) (optional)
         *      -- Obligatory or optional
         */

        [Category("Conversation Rule")]
        //[RequiredArgument] [DescriptionAttribute("Required Field")]
        public InArgument<string> Conv_pattern { get; set; }
        [Category("Conversation Rule")]
        //[RequiredArgument] [DescriptionAttribute("Required Field")]
        public InArgument<string> Conv_template { get; set; }
        [Category("Conversation Rule")]
        public Gesture Conv_gesture { get; set; }
        [Category("Conversation Rule")]
        public bool obligatory { get; set; }
     

        protected override void CacheMetadata(NativeActivityMetadata metadata)
        {
            //metadata.AddChild(Body);
            base.CacheMetadata(metadata);

        }

        protected override void Execute(NativeActivityContext context)
        {
            String inPattern = context.GetValue(Ling_Pattern);
            Result.Set(context,"Patron: "+ inPattern);

            //if ((!context.GetValue(Ling_Pattern).Equals("")) && (context.GetValue(Ling_Template).Equals("")))
            //{
            //    Console.Write("Deberiamos rellenar los campos del patron");
            //}

            //context.ScheduleActivity(Body);

        }
    }
}
